object Beer {
    def main() : Unit = {
        if (new Drinker().wall(99)) {
            println(" "); //Cool
        }
    }
}

class Drinker {
    def wall(num : Int) : Bool = {
        var useless : Bool;
        var bottles : Bottles;
        var song1 : String;
        var song2 : String;
        song1 = "on the wall";
        song2 = "Take one down and pass it around, ";
        bottles = new Bottles();

        if (!(num == 0)) {
            println(bottles.number(num) + song1 + "," + bottles.number(num));
            println(song2 + bottles.number(num-1));
            useless = this.wall(num-1);
        }
        return true;
    }
}

class Bottles {
    def number(num : Int) : String = {
        var retour : String;
        if (num == 0) {
            retour = "no more bottles of beer";
        } else {
            if (num == 1) {
                retour = "1 bottle of beer";
            } else {
                retour = num + " bottles of beer";
            }
        }
        return retour;
    }
}
